home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / lib / include / sun4.md / RCS / a.out.h,v < prev    next >
Encoding:
Text File  |  1991-09-24  |  5.4 KB  |  235 lines

  1. head     1.5;
  2. branch   ;
  3. access   ;
  4. symbols  ;
  5. locks    ; strict;
  6. comment  @ * @;
  7.  
  8.  
  9. 1.5
  10. date     91.09.24.12.29.43;  author mendel;  state Exp;
  11. branches ;
  12. next     1.4;
  13.  
  14. 1.4
  15. date     90.12.07.23.53.28;  author rab;  state Exp;
  16. branches ;
  17. next     1.3;
  18.  
  19. 1.3
  20. date     90.10.26.01.16.19;  author rab;  state Exp;
  21. branches ;
  22. next     1.2;
  23.  
  24. 1.2
  25. date     90.02.16.14.06.10;  author rab;  state Exp;
  26. branches ;
  27. next     1.1;
  28.  
  29. 1.1
  30. date     89.12.16.21.06.14;  author rab;  state Exp;
  31. branches ;
  32. next     ;
  33.  
  34.  
  35. desc
  36. @@
  37.  
  38.  
  39. 1.5
  40. log
  41. @I don't remember making this change.
  42. @
  43. text
  44. @/*
  45.  * Copyright (c) 1980 Regents of the University of California.
  46.  * All rights reserved.  The Berkeley software License Agreement
  47.  * specifies the terms and conditions for redistribution.
  48.  *
  49.  *    @@(#)a.out.h    5.2 (Berkeley) 4/7/87
  50.  */
  51.  
  52. /*
  53.  * Definitions of the a.out header
  54.  * and magic numbers are shared with
  55.  * the kernel.
  56.  */
  57. #ifndef _AOUT
  58. #define _AOUT
  59.  
  60. #include <sun4.md/sys/exec.h>
  61.  
  62. extern int Aout_PageSize[];
  63.  
  64. /*
  65.  * Macro to tell whether or not the magic number in an a.out file
  66.  * is an illegal one.
  67.  */
  68.  
  69. #define    N_BADMAG(x) \
  70.     (((x).a_magic)!=OMAGIC && \
  71.      ((x).a_magic)!=NMAGIC && \
  72.      ((x).a_magic)!=ZMAGIC && \
  73.      ((x).a_magic)!=SPRITE_ZMAGIC && \
  74.      ((x).a_magic)!=UNIX_ZMAGIC)
  75.  
  76. /*
  77.  * Macros to tell where various pieces of information start in the
  78.  * a.out file.
  79.  */
  80.  
  81. #define N_PAGSIZ(x) (Aout_PageSize[(x).a_machtype])
  82.  
  83. #define N_TXTOFF(x) \
  84.     ((x).a_magic==ZMAGIC ? 0 : sizeof (struct exec))
  85. #define N_SYMOFF(x) \
  86.     (N_TXTOFF(x) + (x).a_text+(x).a_data + (x).a_trsize + (x).a_drsize)
  87. #define    N_STROFF(x) \
  88.     (N_SYMOFF(x) + (x).a_syms)
  89.  
  90. /*
  91.  * Macros to tell where the various segments start in virtual memory,
  92.  * when the process is loaded.
  93.  */
  94. #include <sun4.md/kernel/procMach.h>
  95.  
  96. #define N_TXTADDR(x) PROC_CODE_LOAD_ADDR(*((ProcExecHeader *) &(x)))
  97. #define N_DATADDR(x) PROC_DATA_LOAD_ADDR(*((ProcExecHeader *) &(x)))
  98. #define N_BSSADDR(x) PROC_BSS_LOAD_ADDR(*((ProcExecHeader *) &(x)))
  99.  
  100. /*
  101.  * Sparc relocation types
  102.  */
  103.  
  104. enum reloc_type
  105. {
  106.         RELOC_8,        RELOC_16,       RELOC_32,       /* simplest relocs    */
  107.         RELOC_DISP8,    RELOC_DISP16,   RELOC_DISP32,   /* Disp's (pc-rel)    */
  108.         RELOC_WDISP30,  RELOC_WDISP22,                  /* SR word disp's     */
  109.         RELOC_HI22,     RELOC_22,                       /* SR 22-bit relocs   */
  110.         RELOC_13,       RELOC_LO10,                     /* SR 13&10-bit relocs*/
  111.         RELOC_SFA_BASE, RELOC_SFA_OFF13,                /* SR S.F.A. relocs   */
  112.         RELOC_BASE10,   RELOC_BASE13,   RELOC_BASE22,   /* base_relative pic */
  113.         RELOC_PC10,     RELOC_PC22,                     /* special pc-rel pic*/
  114.         RELOC_JMP_TBL,                                  /* jmp_tbl_rel in pic */
  115.         RELOC_SEGOFF16,                                 /* ShLib offset-in-seg*/
  116.         RELOC_GLOB_DAT, RELOC_JMP_SLOT, RELOC_RELATIVE, /* rtld relocs        */
  117. };
  118.  
  119. /*
  120.  * Format of a relocation datum.
  121.  */
  122.  
  123. struct reloc_info_sparc /* used when header.a_machtype == M_SPARC */
  124. {
  125.         unsigned long int r_address;    /* address which is relocated         */
  126.         unsigned int    r_index   :24;  /* segment index or symbol index      */
  127.         unsigned int    r_extern  : 1;  /* if F, r_index==SEG#; if T, SYM idx */
  128.         int                       : 2;  /* <unused>                           */
  129.         enum reloc_type r_type    : 5;  /* type of relocation to perform      */
  130.         long int        r_addend;       /* addend for relocation value        */
  131. }; 
  132.  
  133.  
  134. #define    relocation_info reloc_info_sparc
  135. #if 0
  136. struct relocation_info {
  137.     int    r_address;    /* address which is relocated */
  138. unsigned int    r_symbolnum:24,    /* local symbol ordinal */
  139.         r_pcrel:1,     /* was relocated pc relative already */
  140.         r_length:2,    /* 0=byte, 1=word, 2=long */
  141.         r_extern:1,    /* does not include value of sym referenced */
  142.         :4;        /* nothing, yet */
  143. };
  144. #endif
  145.  
  146. /*
  147.  * Format of a symbol table entry; this file is included by <a.out.h>
  148.  * and should be used if you aren't interested the a.out header
  149.  * or relocation information.
  150.  */
  151. struct    nlist {
  152.     union {
  153.         char    *n_name;    /* for use when in-core */
  154.         long    n_strx;        /* index into file string table */
  155.     } n_un;
  156. unsigned char    n_type;        /* type flag, i.e. N_TEXT etc; see below */
  157.     char    n_other;    /* unused */
  158.     short    n_desc;        /* see <stab.h> */
  159. unsigned long    n_value;    /* value of this symbol (or sdb offset) */
  160. };
  161. #define    n_hash    n_desc        /* used internally by ld */
  162.  
  163. /*
  164.  * Simple values for n_type.
  165.  */
  166. #define    N_UNDF    0x0        /* undefined */
  167. #define    N_ABS    0x2        /* absolute */
  168. #define    N_TEXT    0x4        /* text */
  169. #define    N_DATA    0x6        /* data */
  170. #define    N_BSS    0x8        /* bss */
  171. #define    N_COMM    0x12        /* common (internal to ld) */
  172. #define    N_FN    0x1e        /* file name symbol */
  173.  
  174. #define    N_EXT    01        /* external bit, or'ed in */
  175. #define    N_TYPE    0x1e        /* mask for all the type bits */
  176.  
  177. /*
  178.  * Sdb entries have some of the N_STAB bits set.
  179.  * These are given in <stab.h>
  180.  */
  181. #define    N_STAB    0xe0        /* if any of these bits set, a SDB entry */
  182.  
  183. /*
  184.  * Format for namelist values.
  185.  */
  186. #define    N_FORMAT    "%08x"
  187.  
  188. #endif /* _AOUT */
  189. @
  190.  
  191.  
  192. 1.4
  193. log
  194. @Unix compatibility.
  195. @
  196. text
  197. @d91 1
  198. @
  199.  
  200.  
  201. 1.3
  202. log
  203. @Fix definition of N_BSSADDR.
  204. @
  205. text
  206. @d27 5
  207. a31 1
  208.     (((x).a_magic)!=OMAGIC && ((x).a_magic)!=NMAGIC && ((x).a_magic)!=ZMAGIC)
  209. @
  210.  
  211.  
  212. 1.2
  213. log
  214. @Fixed include path so this file can be used in cross-compiled programs.
  215. @
  216. text
  217. @d51 1
  218. a51 1
  219. #define N_BSSADDR(x) PROC_DATA_BSS_ADDR(*((ProcExecHeader *) &(x)))
  220. @
  221.  
  222.  
  223. 1.1
  224. log
  225. @Initial revision
  226. @
  227. text
  228. @d17 1
  229. a17 1
  230. #include <sys/exec.h>
  231. d47 1
  232. a47 1
  233. #include <kernel/procMach.h>
  234. @
  235.